#include "uidesign.h"

UIDesign::UIDesign()
{

}

void UIDesign::setButtonUI(QPushButton* btn){

    btn->setStyleSheet("QWidget{"
                        "background-color:"
                            "qlineargradient(x1:0, y1:0, x2:1, y2:0,"
                            "stop:0 rgba(31,162,255, 255),"
                            "stop:0.5 rgba(18,216,250, 255),"
                            "stop:1 rgba(166,255,203, 255)"
                        ");"
                           "border-width:2px;"
                           "border-style:outset;"
                           "border-color:rgba(31,162,255,255);"
                           "font-family:Microsoft Yahei;"
                           "font-size:20px;"                       //字体，字体大小
                           "color:rgba(0,0,0,255);"                //字体颜色
                           "border-radius:15px}"
                       "QPushButton:pressed{"
                           "background-color:rgba(18,216,250,200);"
                           "border-color:rgba(18,216,250,255);"
                            "border-width:2px;"
                           "border-style:inset;"
                            "font-family:Microsoft Yahei;"
                            "font-size:18px;"
                           "color:black;"
                           "}");

}

void UIDesign::setLineEditUI(QLineEdit* line){
    line->setStyleSheet(
                "QWidget{"
                    "background-color:"
                        "qlineargradient(x1:0, y1:0, x2:1, y2:0,"
                        "stop:0 rgba(18,194,233, 255),"
                        "stop:0.5 rgba(196,113,237, 255),"
                        "stop:1 rgba(246,79,89, 255)"
                    ");"
                       "border-width:2px;"
                       "border-style:inset;"
                       "border-color:rgba(196,113,237,155);"
                        "padding-left:6px;"
                        "padding-right:6px;"
                       "font-family:Microsoft Yahei;"
                       "font-size:20px;"                       //字体，字体大小
                       "color:rgba(0,0,0,255);"           //字体颜色
                       "border-radius:15px}"
                   );
}

void UIDesign::setWindowUI(QWidget* win){
    win->setStyleSheet(
                "QWidget{"
                    "background-color:"
                        "qlineargradient(x1:0, y1:0, x2:0, y2:1,"
                        "stop:0 rgba(156,236,251, 255),"
                        "stop:0.5 rgba(101,199,247, 255),"
                        "stop:1 rgba(0,82,212, 255)"
                    ");"
                       "font-family:Microsoft Yahei;"
                       "font-size:20px;"                       //字体，字体大小
                       "color:rgba(0,0,0,255);"           //字体颜色
                       "border-radius:20px}"
                   );
}

void UIDesign::setTransparent(QWidget* wid){
    wid->setStyleSheet(
                "QWidget{"
                    "background-color: rgba(0,0,0,0);}"
                );
}

void UIDesign::setMainButtonUI(QPushButton* btn){

    btn->setStyleSheet("QWidget{"
                        "background-color:"
                            "qlineargradient(x1:0, y1:0, x2:1, y2:0,"
                            "stop:0 rgba(31,162,255, 255),"
                            "stop:0.5 rgba(18,216,250, 255),"
                            "stop:1 rgba(166,255,203, 255)"
                        ");"
                           "border-width:1px;"
                           "border-style:outset;"
                           "border-color:rgba(31,162,255,255);"
                           "border-radius:15px}"
                       "QPushButton:pressed{"
                           "background-color:rgba(18,216,250,200);"
                           "border-color:rgba(18,216,250,255);"
                            "border-width:1px;"
                           "border-style:inset;"
                            "font-size:24px;"
                           "}");

}

void UIDesign::setMainWindowUI(QWidget* win){
    win->setStyleSheet(
                "QWidget{"
                    "background-color:"
                        "#247BA0"
                        //"qlineargradient(x1:0, y1:0, x2:1, y2:0,"
                        //"stop:0 rgba(84,51,255, 255),"
                        //"stop:0.5 rgba(32,189,255, 255),"
                        //"stop:1 rgba(165,254,203, 255))"
                    "}"
                   );
}

void UIDesign::setListWidgetUI(QListWidget* list){
    list->setStyleSheet(
                "QListWidget{"
                    "background-color:"
                        "qlineargradient(x1:0, y1:0, x2:1, y2:0,"
                        "stop:0 #36D1DC,"
                        "stop:1 #5B86E5"
                    ");"
                        "border-width: 3px;"
                        "border-style:inset;"
                        "border-color:#36D1DC;"
                       "border-radius:8px}"
                "QListWidget::item {"
                    "background-color: rgba(0,159,255, 140);"
                    "color: #000000;"
                    "border-bottom: 1px solid #dbdbdb;"
                    "padding: 8px;"
                "}"
                "QListWidget::item:hover {"
                    "background-color: #f5f5f5;"
                "}"
                "QListWidget::item:selected {"
                    "border-left: 6px solid #4286F4"
                "}"
                );
}

void UIDesign::setTabUI(QTabWidget* tab){
    tab->setStyleSheet(
                //（1）QTabWidget显示区域的属性设置
                "QTabWidget::pane {"
                    "border-width: 0px;"
                    "border-color:(0,0,0,0);"
                "}"

                //（2）QTabWidget 选择项的属性设置
                "QTabBar::tab {"
                    "border-width: 1px;"
                    "max-width: 75px; min-width:75px; min-height:25px;"
                    "border-bottom-color: #36D1DC;" /* same as the pane color */
                    "border-top-left-radius: 4px;"
                    "border-top-right-radius: 4px;"
                    "background-color:#5B86E5;"
                    "margin-left: 6px;"
                "}"
                "QTabBar::tab:selected {"
                    "border-bottom: 2px solid #000000;"
                    "min-height:35px;"
                    "font-weight:bold;"
                    "background-color:#36D1DC;"
                "}"
                "QTabBar::tab:!selected{"
                    "min-height:25px;"
                    "margin-top: 6px;"
                "}"
                );

}

void UIDesign::setTextListUI(QTextEdit* list){
    list->setStyleSheet(
                "QWidget{"
                    "background-color:"
                        "qlineargradient(x1:0, y1:0, x2:1, y2:0,"
                        "stop:0 #8E9EAB,"
                        "stop:0.5 #DBDBDB,"
                        "stop:1 #EEF2F3"
                    ");"
                        "border-width: 2px;"
                        "border-style:inset;"
                        "border-color:#36D1DC;"
                       "border-radius:8px}"
                );
}

void UIDesign::setContentListUI(QListWidget* list){
    list->setStyleSheet(
                "QListWidget{"
                    "background-color:"
                        "qlineargradient(x1:0, y1:0, x2:1, y2:0,"
                        "stop:0 #757F9A,"
                        "stop:1 #D7DDE8"
                    ");"
                        "border-width: 3px;"
                        "border-style:inset;"
                        "border-color:#36D1DC;"
                       "border-radius:8px}"
                "QListWidget::item {"
                    "border-radius: 6px;"
                    "background-color:transparent;"
                    "margin-left:1px"
                "}"
                );
}
